<template>
  <div>
    <div @click="test">
      点我
    </div>
    <!-- <div v-for="(item,index ) in 30" :key="index" class="langz">
      <img v-lazy="src" class="img_item lazy-img-fadein">
    </div> -->

    <el-image v-for="(item,index ) in 30" :key="index" :src="src" class="elimg" lazy>
      <div slot="placeholder" class="image-slot">
        加载中<i class="el-icon-loading" />
      </div>
      <div slot="error" class="image-slot">
        <i class="el-icon-picture-outline" />
      </div>
    </el-image>
  </div>
</template>
<script>
export default {
  middleware: ['permission'], // 单个组件使用中间件
  data () {
    return {
      src: require('@/static/img/t2.jpg')
    }
  },
  methods: {
    test () {
      this.$store.commit('token/setIndex', 1)
      // const ids = 5
      this.$router.push('/new/33')
    }
  }
}
</script>
<style lang='scss' scoped>
.langz {
  width: 300px;
  height: 180px;
  img{
    width: 100%;
    height: 100%;
  }
}
img[lazy="loading"] {
  width: 30px;
  height: 30px;
  margin: 0 auto;
}

/* 图片懒加载效果 */
img[lazy=loaded] {
  width: 100%;
  height: 100%;
  animation-duration: 6s;
  animation-fill-mode: both;
  animation-name: fadeIn;
}
.elimg{
  width: 150px;
  height: 100px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #eee;
  margin-bottom: 10px;
}
.image-slot{

}
</style>
